package com.springboot.web;

import com.springboot.service.WangRepository;
import com.springboot.config.AppConfig;
import com.springboot.domain.Wangxing;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by wangxing
 * Date: 2016/12/19.
 * Time: 14:53
 */
@RestController
public class HelloController {

    @Autowired
    private AppConfig appConfig;

    @Autowired
    private WangRepository wangRepository;

    @RequestMapping(value = "/hello")
    public String getHelloWorld(){
        return appConfig.getAddress();
    }

    @RequestMapping(value = "/list")
    public List<Wangxing> getWangList(){
        return wangRepository.findAll();
    }



}
